﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GLImp;
using System.Drawing;

namespace CastleOfTheDisillusioned {
	class Particle : Entity {
		public Color Color;
		public double VSpeed;
		public double HSpeed;
		public int Lifespan;
		public double Gravity;

		public bool IsDead = false;

		protected Particle() { }

		public Particle(double X, double Y, double Size, Color color) {
			this.X = X;
			this.Y = Y;
			this.Color = color;
			this.Width = Size;
			this.Height = Size;

			VSpeed = 0;
			HSpeed = 0;
			Lifespan = 60;
		}

		public override void Draw() {
			GraphicsManager.DrawRectangle(X, Y, Width, Height, Color);
		}

		public override void Update() {
			VSpeed += Gravity;
			X += HSpeed;
			Y += VSpeed;
			if (--Lifespan <= 0) {
				Remove();
			}
		}

		private void Remove() {
			IsDead = true;
		}
	}
}
